package com.jbm.jsm.iface;

import com.jbm.core.iface.IAcross;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
import java.util.List;

/**
 * Created by Administrator on 2017/9/26.
 */
@Entity
@Table(name = "authority", schema = "", catalog = "jsm")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AuthorityEntity extends IAcross
{
    private int aId;
    private String code;
    private String name;
    private Timestamp createDate;
    private Integer identity;
    private Integer prevId;
    private Integer forestage;
    private Integer backstage;
    private Integer isview;
    public AuthorityEntity()
    {
        super();
    }

    public AuthorityEntity(IAcross ia)
    {
        super(ia);
    }

    @Id
    @Column(name = "a_id")
    @GeneratedValue
    public int getaId() {
        return aId;
    }

    public void setaId(int aId) {
        this.aId = aId;
    }

    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "identity")
    public Integer getIdentity() {
        return identity;
    }

    public void setIdentity(Integer identity) {
        this.identity = identity;
    }

    @Basic
    @Column(name = "prev_id")
    public Integer getPrevId() {
        return prevId;
    }

    public void setPrevId(Integer prevId) {
        this.prevId = prevId;
    }

    @Basic
    @Column(name = "forestage")
    public Integer getForestage() {
        return forestage;
    }

    public void setForestage(Integer forestage) {
        this.forestage = forestage;
    }

    @Basic
    @Column(name = "backstage")
    public Integer getBackstage() {
        return backstage;
    }

    public void setBackstage(Integer backstage) {
        this.backstage = backstage;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AuthorityEntity that = (AuthorityEntity) o;

        if (aId != that.aId) return false;
        if (backstage != null ? !backstage.equals(that.backstage) : that.backstage != null) return false;
        if (code != null ? !code.equals(that.code) : that.code != null) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (forestage != null ? !forestage.equals(that.forestage) : that.forestage != null) return false;
        if (identity != null ? !identity.equals(that.identity) : that.identity != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (prevId != null ? !prevId.equals(that.prevId) : that.prevId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = aId;
        result = 31 * result + (code != null ? code.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (identity != null ? identity.hashCode() : 0);
        result = 31 * result + (prevId != null ? prevId.hashCode() : 0);
        result = 31 * result + (forestage != null ? forestage.hashCode() : 0);
        result = 31 * result + (backstage != null ? backstage.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "isview")
    public Integer getIsview() {
        return isview;
    }

    public void setIsview(Integer isview) {
        this.isview = isview;
    }

    @Transient
    public List<AuthorityEntity> auths;
}
